from pylab import *
import numpy as np
import cv2
import time

from yolo.net import Yolo

# model_yolo = Yolo("./config_demo.json")

def infer(m):
    print("shape:{}".format(m.shape))
    print(m)
    plt.imshow(m)
    plt.show()

def probe_mat(m0,m1,m2):
    print("time:{}".format(time.time()))
    # print("Inside python m0 = \n ", m0)
    m0 = np.expand_dims(m0, 2)
    m1 = np.expand_dims(m1, 2)
    m2 = np.expand_dims(m2, 2)
    im = np.concatenate((m0,m1,m2),2)
    print("time:{} shape:{}".format(time.time(),im.shape))
    # plt.imshow(im)
    # plt.show()
    xyc_pack = model_yolo.predict(im, show_im=False)
    # print(xyc_pack)
    return xyc_pack

if __name__ == '__main__':
    im = cv2.imread('test_im1080.jpg')
    print("time:{} shape:{}".format(time.time(), im.shape))
    xyc_pack = model_yolo.predict(im, show_im=True)
    print(xyc_pack)
    print("num car detected: {}".format(len(xyc_pack)))